package cn.mw.cmdb.enums;

import java.util.ArrayList;
import java.util.List;

public enum ZabbixItemEnum {
    CPU_CORE("CPU_CORE", "CPU核数"),
    MEMORY_TOTAL("MEMORY_TOTAL", "内存总量"),
    SYSTEM_UPTIME("system.uptime", "系统运行时间"),
    MW_HOST_AVAILABLE("MW_HOST_AVAILABLE", "资产可用性"),
    MW_DB_STATUS("MW_DB_STATUS", "数据库资产可用性"),
    ICMP_PING("ICMP_PING", "ping状态");

    private String itemName;

    private String desc;

    public String getItemName() {
        return itemName;
    }

    public String getDesc() {
        return desc;
    }

    ZabbixItemEnum(String itemName, String desc) {
        this.itemName = itemName;
        this.desc = desc;
    }

    public static ZabbixItemEnum getItemEnumByName(String itemName) {
        for (ZabbixItemEnum homeItemEnum : values()) {
            if (itemName.equals(homeItemEnum.getItemName())) {
                return homeItemEnum;
            }
        }
        return null;
    }

    public static List<String> getAllItemName() {
        List<String> itemNames = new ArrayList<>();
        for (ZabbixItemEnum homeItemEnum : values()) {
            itemNames.add(homeItemEnum.itemName);
        }
        return itemNames;
    }
}
